/**
 * Created by zhangwenlei on 2017/4/12.
 */
BCP.bill.domControl.Subtable=function(parent){
    BCP.bill.domControl.Subtable.superclass.constructor.call(this,parent);
};

COM.util.defineClass(BCP.bill.domControl.Subtable,ADF.domControl.BaseControl, {
    getLabel: function(){
        return "Subtable";
    },
    setInitData: function(data) {
        //TODO 根据数据绘制预览表格
        //data就是表格序列化后的数据
        var newTable = $(this.getDomElement()).find('.tableParent').toCreateZcTable({});
        newTable.setSerialize(data.tableData);
        $(this.getDomElement()).attr('tableAttriName',data.selectTableAttr);
    },
    _getDomElement: function(model) {
        var subtable = COM.util.HTMLUtil.createELement('<div><div class="tableContent"><div class="tableParent"></div></div></div>');

        var tableParent = subtable.find(".tableParent").toCreateZcTable({});
        tableParent.setSerialize(model.getInitData().tableData);

        subtable.attr('tableAttriName',model.getInitData().selectTableAttr);

        return subtable[0];
    }
});